/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "milestone")
@NamedQueries({
    @NamedQuery(name = "Milestone.findAll", query = "SELECT m FROM Milestone m"),
    @NamedQuery(name = "Milestone.findByMsId", query = "SELECT m FROM Milestone m WHERE m.msId = :msId"),
    @NamedQuery(name = "Milestone.findByMsSituation", query = "SELECT m FROM Milestone m WHERE m.msSituation = :msSituation"),
    @NamedQuery(name = "Milestone.findByMsName", query = "SELECT m FROM Milestone m WHERE m.msName = :msName")})
public class Milestone implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ms_id")
    private Integer msId;
    @Basic(optional = false)
    @Column(name = "ms_situation")
    private double msSituation;
    @Basic(optional = false)
    @Column(name = "ms_name")
    private String msName;
    @JoinColumn(name = "project_id", referencedColumnName = "p_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Project project;

    public Milestone() {
    }

    public Milestone(Integer msId) {
        this.msId = msId;
    }

    public Milestone(Integer msId, double msSituation, String msName) {
        this.msId = msId;
        this.msSituation = msSituation;
        this.msName = msName;
    }

    public Integer getMsId() {
        return msId;
    }

    public void setMsId(Integer msId) {
        this.msId = msId;
    }

    public double getMsSituation() {
        return msSituation;
    }

    public void setMsSituation(double msSituation) {
        this.msSituation = msSituation;
    }

    public String getMsName() {
        return msName;
    }

    public void setMsName(String msName) {
        this.msName = msName;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (msId != null ? msId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Milestone)) {
            return false;
        }
        Milestone other = (Milestone) object;
        if ((this.msId == null && other.msId != null) || (this.msId != null && !this.msId.equals(other.msId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.Milestone[msId=" + msId + "]";
    }

}
